package com.ruoyi.back.service.impl

import com.baomidou.mybatisplus.extension.kotlin.KtQueryWrapper
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
import com.ruoyi.app.common.Data
import com.ruoyi.app.common.Ok
import com.ruoyi.back.domain.ClubJobSetting
import com.ruoyi.back.mapper.ClubJobSettingMapper
import com.ruoyi.back.service.ClubJobSettingService
import org.springframework.stereotype.Service

@Service
class ClubJobSettingServiceImpl : ServiceImpl<ClubJobSettingMapper, ClubJobSetting>(), ClubJobSettingService {

    override fun clubJobSetting(): Data<ClubJobSetting> = Ok("获取设置项成功", getOne(KtQueryWrapper(ClubJobSetting::class.java)))

    override fun saveClubJobSetting(clubJobSetting: ClubJobSetting): Data<Boolean> =
        clubJobSetting.id?.run {
            Ok("更新成功", updateById(clubJobSetting))
        } ?: kotlin.run {
            Ok("保存成功", save(clubJobSetting))
        }
}